//获取ul
var ulbox=document.querySelector("#product .info")
//图片正则


fetch("http://chst.vip:1234/api/getinlanddiscount").then(function(response){
    return response.json();
}).then(function(res){
    console.log(res);
    res.result.forEach(item => {
        console.log(item);
        // var regExp = /^<[^<]+\s+src="([^''""]*)"/;
        // var img=regExp.exec(item.productImg)[0];
        // console.log(item.productImg);
        // console.log(img);
        console.log(item.productId);
        
        var oli=document.createElement("li");
        
        oli.innerHTML=              `
                    <a href="http://chst.vip:8081/for-stu/wfzh/inlandproduct.html?productid=${item.productId}&title=%E5%9B%BD%E5%86%85%E6%8A%98%E6%89%A3">
                        <div class="image">
                        ${item.productImg}
                        </div>
                        <div class="title">${item.productName}</div>
                        <p class="price">${item.productPrice}</p>
                        <p class="from">${item.productFrom}|${item.productTime}</p>
                    </a>  `
           
                          console.log(oli);
                          ulbox.appendChild(oli);
    });

                    console.log(ulbox);
        
})
